#include<bits/stdc++.h>
using namespace std;
long long n,cnt,ab,ans,num;
int a[100005];
int main(){
	freopen("duel.in","r",stdin);
	freopen("duel.out","w",stdout);
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>num;
		a[num]++;
	}
	for(int i=1;i<=100000;i++){
		if(a[i]!=0){
			cnt=n-ans-a[i];
			ab=cnt-a[i];
			if(ab<=0){
				ans+=cnt;
				break;
			}
			else
				ans+=a[i];
		}
	}
	cout<<n-ans<<endl;
	return 0;
}
